<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main"/>
    <g:set var="entityName" value="${message(code: 'estate.label', default: 'estate')}"/>
    <title>分析报告</title>
    <style>
    .table>tbody>tr>td{
        vertical-align: middle;
    }
    </style>
</head>

<body class="fixed-navbar fixed-sidebar">
<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right">
                <ol class="hbreadcrumb breadcrumb">
                    <li>CINDATA PLS</li>
                    <li class="active">
                        <span>分析报告</span>
                    </li>
                </ol>
            </div>

            <h2 class="font-light m-b-xs">
                %{--<a href="index" class="pe-7s-back fa-2x">&nbsp;&nbsp;</a>--}%
                分析报告
            </h2>
        </div>
    </div>
</div>

<div class="content animate-panel">

    <div class="row">
        <g:form method="POST" action="report" class="form-horizontal" role="form">
            <div class="hpanel hblue">
                <div class="panel-heading">
                    查询
                    <div class="panel-tools">
                        <button class="btn btn-primary btn-xs" id="searchData" type="submit"><i class="fa fa-search"></i> 查询</button>
                        <button class="btn btn-warning2 btn-xs" type="button" id="resetBtn"><i class="fa fa-times"></i> 重置</button>
                    </div>
                </div>

                <div class="panel-body seach-group" id="bug1">
                    <div class="row">
                        <div class="form-group col-sm-3">
                            <label for="city" class="col-sm-4 control-label">城市</label>
                            <div class="col-sm-8">
                                <g:select class="form-control" name="city" id="city" from="${com.cindata.City.executeQuery("select distinct e.city as city from  Estate e where e.city.id <> 1660")}" valueMessagePrefix="status" optionKey="zoneNumber" optionValue="name" value="${params?.city}" noSelection="${['': '请选择城市']}"/>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </g:form>
    </div>

    <div class="row">
        <div class="hpanel hgreen">
            <div class="panel-heading">
                <div class="panel-tools">
                    <a class="pull-left" href="../assets/Report Guangzhou.pdf" download>
                        <button type="button" class="btn btn-primary btn-xs"> 一键呈报</button>
                    </a>
                    &nbsp;
                    <button class="btn  btn-warning2 btn-xs " type="button" id="toPrint"><i class="fa fa-print"></i> 打印报告</button>
                    <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                </div>
                押品分析
            </div>
            <div class="panel-body" style="border-bottom: none; padding-bottom: 0">
                <div>
                    <h4 style="font-size: 13px;">城市/行政区押品分布</h4>
                    <g:if test="${estateCounts != 0}">
                        <span><strong>${this.accountName}</strong> 押品分布在 <strong style="color: #FF0000;">${districtCounts}</strong> 个行政区，共 <strong style="color: #FF0000;">${estateCounts}</strong> 件押品，其中在 <strong style="color: #62cb31;">${districtName1}</strong> 的数量最多，有 <strong style="color: #FF0000;">${districtEstateCounts1}</strong> 件，占全量押品的 <strong style="color: #FF0000;"><g:formatNumber number="${districtEstateCounts1/estateCounts*100}" minFractionDigits="2" maxFractionDigits="2"/>%</strong>，其次为 <strong style="color: #62cb31;">${districtName2}</strong> 和 <strong style="color: #62cb31;">${districtName3}</strong>，押品数量分别为 <strong style="color: #FF0000;">${districtEstateCounts2}</strong> 件和 <strong style="color: #FF0000;">${districtEstateCounts3}</strong> 件，分别占全量押品的 <strong style="color: #FF0000;"><g:formatNumber number="${districtEstateCounts2/estateCounts*100}" minFractionDigits="2" maxFractionDigits="2"/>%</strong> 和 <strong style="color: #FF0000;"><g:formatNumber number="${districtEstateCounts3/estateCounts*100}" minFractionDigits="2" maxFractionDigits="2"/>%</strong></span>
                    </g:if>
                    <g:else>
                        <span><strong>${this.accountName}</strong> 押品分布在 <strong  style="color: #FF0000;">${districtCounts}</strong> 个行政区，共 <strong style="color: #FF0000;">${estateCounts}</strong> 件押品，其中在 <strong style="color: #62cb31;">${districtName1}</strong> 的数量最多，有 <strong style="color: #FF0000;">${districtEstateCounts1}</strong> 件，占全量押品的 <strong  style="color: #FF0000;">0.00%</strong>，其次为 <strong style="color: #62cb31;">${districtName2}</strong> 和 <strong style="color: #62cb31;">${districtName3}</strong>，押品数量分别为 <strong style="color: #FF0000;">${districtEstateCounts2}</strong> 件和 <strong style="color: #FF0000;">${districtEstateCounts3}</strong> 件，分别占全量押品的 <strong style="color: #FF0000;">0.00%</strong> 和 <strong style="color: #FF0000;">0.00%</strong></span>
                    </g:else>
                </div>
                <div>
                    <h4 style="font-size: 13px;">小区级押品分布</h4>
                    <g:if test="${estateCounts != 0}">
                        <span>全量押品分布在 <strong style="color: #FF0000;">${communityCounts}</strong> 个小区中，押品数量最多的小区为 <strong style="color: #62cb31;">${d1}</strong> 的 <strong style="color: #62cb31;">${c1}</strong> 和 <strong style="color: #62cb31;">${d2}</strong> 的 <strong style="color: #62cb31;">${c2}</strong> 两个小区，其中分布占比 <strong style="color: #FF0000;"><g:formatNumber number="${t1/estateCounts*100}" minFractionDigits="2" maxFractionDigits="2"/>%</strong> 和 <strong style="color: #FF0000;"><g:formatNumber number="${t2/estateCounts*100}" minFractionDigits="2" maxFractionDigits="2"/>%</strong></span>
                    </g:if>
                    <g:else>
                        <span>全量押品分布在 <strong style="color: #FF0000;">${communityCounts}</strong> 个小区中，押品数量最多的小区为 <strong style="color: #62cb31;">${d1}</strong> 的 <strong style="color: #62cb31;">${c1}</strong> 和 <strong style="color: #62cb31;">${d2}</strong> 的 <strong style="color: #62cb31;">${c2}</strong> 两个小区，其中分布占比 <strong style="color: #FF0000;">0.00%</strong> 和 <strong style="color: #FF0000;">0.00%</strong></span>
                    </g:else>
                    <div>



                    </div>
                </div>
            </div>

            <div class="row">
                <div class="hpanel" style="">

                    <div class="col-md-12">
                        <div class="hpanel">

                            <h4 class="showhide" style="padding: 0;margin: 0;margin-right: 0px;padding-left: 20px;background: #fff;padding-top: 10px;padding-bottom: 10px;font-size: 13px;cursor: pointer;color: #62cb31;font-weight: bold;border: 1px solid #eaeaea;border-top: none;border-bottom: none;">top20小区押品数量
                                <div class="panel-tools pull-right">
                                    <a class=""><i class="fa fa-chevron-down" style="font-size: 13px; margin-right: 9px;"></i></a>
                                </div>
                            </h4>

                            <div class="panel-body" style="border:none; display: none;border-left: 1px solid #e5e5e5;border-right: 1px solid #e5e5e5;">
                                <div class="table-responsive">
                                    <table cellpadding="1" cellspacing="1" class="table table-striped table-bordered table-hover text-center" id="esateTable">
                                        <thead>
                                        <tr>
                                            <g:sortableColumn property="city" title="城市" class="col-md-1 text-center" params="${params}"/>
                                            <g:sortableColumn property="district" title="行政区" class="col-md-1 text-center" params="${params}"/>
                                            <g:sortableColumn property="fullName" title="小区名称" class=" col-md-1 text-center" params="${params}"/>
                                            <g:sortableColumn property="counts" title="押品数量" class=" col-md-1 text-center" params="${params}"/>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <g:each in="${top20CommunityList}">
                                            <tr>
                                                <td class="text-center">${it?.city}</td>
                                            <td class="text-center">${it?.district}</td>
                                            <td class="text-center">${it?.community}</td>
                                            <td class="text-center">${it?.counts}</td>
                                            </td>
                                        </tr>
                                        </g:each>
                                        </tbody>
                                    </table>
                                </div>

                                <div>
                                    <h4 style="padding:0;margin:0; background: #fff; padding-top: 10px;padding-bottom: 10px; border: none;font-size: 13px;cursor: pointer;color: #62cb31;font-weight: bold"><strong>top5小区价格变动趋势</strong></h4>
                                    <div id="communityPriceTrend" style="width: 100%;height: 420px;"></div>
                                </div>

                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>



    </div>
    <div class="row">
        <div class="hpanel hgreen">
            <div class="panel-heading">
                <div class="panel-tools">
                    <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                </div>
                贷款分析
            </div>
            <div class="panel-body">
                <div>
                    <h4 style="font-size: 13px;">押品押入期分布</h4>
                    <span><strong>${accountName}</strong> 全量押品押入期主要集中在 <strong style="color: #FF0000;"><span id="y1">年、</span></strong><strong style="color: #FF0000;"><span id="y2">年、</span></strong> <strong style="color: #FF0000;"><span id="y3">年、</span></strong>各年份放款数量如下：</span>
                    <div id="estateStart" style="width: 100%;height: 420px;"></div>
                </div>
                <hr/>
                <div>
                    <h4 style="font-size: 13px;">押品剩余还款期分布</h4>
                    <g:if test="${estateCounts != 0}">
                        <span><strong>${accountName}</strong> 按剩余还款期限统计押品数量，剩余还款期限在 <strong style="color: #FF0000;">${remainTimeList[0].remainTime}</strong> 的押品数据最多，包括 <strong style="color: #FF0000;">${remainTimeList[0].counts}</strong> 件押品，占总量押品的 <strong style="color: #FF0000;"><g:formatNumber number="${remainTimeList[0].counts/estateCounts * 100}" minFractionDigits="2" maxFractionDigits="2"/>%</strong>；其次是剩余还款期限在 <strong style="color: #FF0000;">${remainTimeList[1].remainTime}</strong> 年的押品，包括 <strong style="color: #FF0000;">${remainTimeList[1].counts}</strong> 件押品，占总量押品的<strong style="color: #FF0000;"><g:formatNumber number="${remainTimeList[1].counts/estateCounts * 100}" minFractionDigits="2" maxFractionDigits="2"/>%</strong>。</span>
                    </g:if>
                    <g:else>
                        <span><strong>${accountName}</strong> 按剩余还款期限统计押品数量，剩余还款期限在 <strong style="color: #FF0000;">${remainTimeList[0].remainTime}</strong> 的押品数据最多，包括 <strong style="color: #FF0000;">${remainTimeList[0].counts}</strong> 件押品，占总量押品的 <strong style="color: #FF0000;">0.00%</strong>；其次是剩余还款期限在 <strong style="color: #FF0000;">${remainTimeList[1].remainTime}</strong> 年的押品，包括 <strong style="color: #FF0000;">${remainTimeList[1].counts}</strong> 件押品，占总量押品的<strong style="color: #FF0000;">0.00%</strong>。</span>
                    </g:else>
                    <div class="table-responsive">
                        <table cellpadding="1" cellspacing="1" class="table table-striped table-bordered table-hover text-center" id="">
                            <thead>
                            <tr>
                                <g:sortableColumn property="city" title="剩余还款期" class="col-md-1 text-center" params="${params}"/>
                                <g:sortableColumn property="district" title="押品数量" class="col-md-1 text-center" params="${params}"/>
                                <g:sortableColumn property="counts" title="占比" class=" col-md-1 text-center" params="${params}"/>
                            </tr>
                            </thead>
                            <tbody>
                            <g:each in="${remainTimeList}">
                                <tr>
                                    <td class="text-center">${it?.remaintime}</td>
                                <td class="text-center">${it?.counts}</td>
                                <td class="text-center"><g:if test="${estateCounts != 0}"><g:formatNumber number="${it?.counts/estateCounts * 100}" minFractionDigits="2" maxFractionDigits="2"/></g:if><g:else>0.00</g:else>%</td>
                                </td>
                            </tr>
                            </g:each>
                            </tbody>
                        </table>
                    </div>
                </div>
                <hr/>
                <div>
                    <h4 style="font-size: 13px;">逾期押品情况预警</h4>
                    <span><strong>${accountName}</strong> 有 <strong style="color: #FF0000;">${overdueCounts}</strong> 件押品，超过还款期限，仍未偿还完，针对这部分押品，银行应该特别重视，以下是逾期押品分布情况：</span>
                    <div class="table-responsive">
                        <table cellpadding="1" cellspacing="1" class="table table-striped table-bordered table-hover text-center" id="">
                            <thead>
                            <tr>
                                <g:sortableColumn property="city" title="小区名称" class="col-md-1 text-center" params="${params}"/>
                                <g:sortableColumn property="district" title="逾期押品数量" class="col-md-1 text-center" params="${params}"/>
                                <g:sortableColumn property="fullName" title="小区基准价（当前）" class=" col-md-1 text-center" params="${params}"/>
                                <g:sortableColumn property="counts" title="押品编号" class=" col-md-1 text-center" params="${params}"/>
                                <g:sortableColumn property="counts" title="受理网点" class=" col-md-1 text-center" params="${params}"/>
                            </tr>
                            </thead>
                            <tbody>
                            <g:each in="${overdueList}">
                                <tr>
                                    <td class="text-center">${it?.communityName}</td>
                                <td class="text-center">${it?.overnumbers}</td>
                                <td class="text-center">${it?.standardPrice}</td>
                                <td class="text-center">${it?.externalId}</td>
                                <td class="text-center">${it?.accountName}</td>
                                </td>
                            </tr>
                            </g:each>
                            </tbody>
                        </table>
                    </div>
                </div>
                <hr/>
                <div>
                    <h4 style="font-size: 13px;">押品重估价值</h4>
                    <g:if test="${currentTotalPrice != 0}">
                        <span><strong>${accountName}</strong> 的押品在 <strong style="color: #62cb31;">${cityName}</strong> 有 <strong style="color: #FF0000;">${estateCounts}</strong> 件，全量押入期（评估机构评估总价）价值为 <strong style="color: #FF0000;"><g:formatNumber number="${loanTotalPrice}" minFractionDigits="2" maxFractionDigits="2"/></strong> 亿，重估期（当前系统评估总价）价值总额为 <strong style="color: #FF0000;"><g:formatNumber number="${currentTotalPrice}" minFractionDigits="2" maxFractionDigits="2"/></strong> 亿元，增幅为 <strong style="color: #FF0000;"><g:formatNumber number="${(currentTotalPrice-loanTotalPrice) / currentTotalPrice * 100}" minFractionDigits="2" maxFractionDigits="2"/>%</strong>。</span>
                    </g:if>
                    <g:else>
                        <span><strong>${accountName}</strong> 的押品在 <strong style="color: #62cb31;">${cityName}</strong> 有 <strong style="color: #FF0000;">${estateCounts}</strong> 件，全量押入期（评估机构评估总价）价值为 <strong style="color: #FF0000;"><g:formatNumber number="${loanTotalPrice}" minFractionDigits="2" maxFractionDigits="2"/></strong> 亿，重估期（当前系统评估总价）价值总额为 <strong style="color: #FF0000;"><g:formatNumber number="${currentTotalPrice}" minFractionDigits="2" maxFractionDigits="2"/></strong> 亿元，增幅为 <strong style="color: #FF0000;">0.00%</strong>。</span>
                    </g:else>
                    <div class="table-responsive">
                        <table cellpadding="1" cellspacing="1" class="table table-striped table-bordered table-hover text-center" id="">
                            <thead>
                            <tr>
                                <g:sortableColumn property="city" title="放款年份" class="col-md-1 text-center" params="${params}"/>
                                <g:sortableColumn property="district" title="押入期总价(亿元)" class="col-md-1 text-center" params="${params}"/>
                                <g:sortableColumn property="fullName" title="重估期总价(亿元)" class=" col-md-1 text-center" params="${params}"/>
                                <g:sortableColumn property="counts" title="增幅" class=" col-md-1 text-center" params="${params}"/>
                            </tr>
                            </thead>
                            <tbody>
                            <g:each in="${evaluateList}">
                                <tr>
                                    <td class="text-center">${it?.startDate}</td>
                                <td class="text-center"><g:formatNumber number="${it?.loanTotalPrice}" minFractionDigits="2" maxFractionDigits="2"/></td>
                                <td class="text-center"><g:formatNumber number="${it?.currentTotalPrice}" minFractionDigits="2" maxFractionDigits="2"/></td>
                                <td class="text-center"><g:formatNumber number="${it?.amplitude * 100}" minFractionDigits="2" maxFractionDigits="2"/>%</td>
                                </td>
                            </tr>
                            </g:each>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>


</div>







<g:javascript>
    
    $("#s2id_city span:first").html('${cityName}');
    $("#city").val('${zoneNumber}');

    //重置按钮
    $("#resetBtn").click(function () {
        $("#s2id_city span:first").html("请选择城市");
        $("#city").val("");
    })

    $("#toPrint").click(function(){
       var city =  $("#city").val();
        //window.open("/analyze/reportPrinting?city="+city)
        window.open("/analyze/report?city="+city+"&gtype=999",'addFileWindow','toolbar=no,location=no,resizable=no, height=768, width=1000,,scrollbars=yes ,left=380,top=100');

    })

</g:javascript>

<asset:javascript src="echarts/echarts-all-3.js" />
<asset:javascript src="main/report.js" />
</body>
</html>
